package xyz.jcat.shardingjdbc.example.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.stereotype.Service;

import xyz.jcat.mybatis.ServiceImpl;
import xyz.jcat.shardingjdbc.example.domain.po.UserPo;
import xyz.jcat.shardingjdbc.example.domain.dao.IUserDao;
import xyz.jcat.shardingjdbc.example.service.IUserService;
/**
 *
 * @author yueyue
 * auto on 2022-03-14 10:19:44
 */
@Service
public class UserService extends ServiceImpl<IUserDao, UserPo> implements IUserService {

    @Override
    public UserPo getByDyId(String dyId) {
        LambdaQueryWrapper<UserPo> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(UserPo::getDyId, dyId);
        return getOne(queryWrapper);
    }

    @Override
    public UserPo getByPhone(String phone) {
        LambdaQueryWrapper<UserPo> queryWrapper = new LambdaQueryWrapper();
        queryWrapper.eq(UserPo::getPhone, phone);
        return getOne(queryWrapper);
    }
}
